package mrdemo005;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 
public class Test1 {
	/**
	 * 求最大值和最小值问题
	 * select max(number), min(number) from table 类似这样，获取某列的最大值和最小值
	 * 
	 * 
	 */

	public static void main(String[] args) throws Exception {

		Configuration conf = new Configuration(); // 加载配置文件
		Job job = new Job(conf); // 创建一个job，供JobTracker使用
//		job.setJarByClass(Test1.class);

		job.setMapperClass(MaxMinMap.class);
		job.setReducerClass(MaxMinReduce.class);

		//FileInputFormat.setInputPaths(job, new Path("hdfs://192.168.52.100:8020/maxminInput"));
		FileInputFormat.setInputPaths(job, new Path("c:/data/maxminInput"));
		
		//FileOutputFormat.setOutputPath(job, new Path("hdfs://192.168.52.100:8020/maxminOutput"));
		FileOutputFormat.setOutputPath(job, new Path("c:/data/maxminOutput"));
		
		//map的输出数据的类型
		job.setOutputKeyClass(IntWritable.class);
		job.setOutputValueClass(Text.class);

		job.waitForCompletion(true);

	}

}
